import { Map } from "immutable"; // 深拷贝state 
import {RES_OK_CODE} from "../types/index" 
import * as actionTypes from "../types/home";


const initialState = Map({
  allList: {},
  systemMessages:[],
  winningList:[],
  playlist : [],
  allinfo:{},
  bannerlist:[]
})

export default function reducer(state = initialState, action) {
    switch (action.type) {

      case actionTypes.REQUEST_SYSTEM_MESSAGE_ALL :
      state = state.set("systemMessages",action.data.datas.ggList)
      state = state.set("bannerlist",action.data.datas.bannerList)
      break;

      case actionTypes.REQUEST_SYSTEM_MESSAGE :
      state = state.set("systemMessages",action.data.datas)
      break;

      case actionTypes.REQUEST_WINNING_LIST :
      state = state.set("winningList",action.data.datas)
      break;
      
      case actionTypes.REQUEST_PLAY_GAME_LIST :
      state = state.set("playlist",action.data.datas)
      break;

      case actionTypes.REQUEST_BANNER_LIST:
      state = state.set("allinfo",action.data.datas)
      state = state.set("bannerlist",action.data.datas.bannerList)

      default:
        return state
    }
    return state
}